function removeDuplicate(nums){
    let j =0
    for(let i=0; i< nums.length; i++) {
        if(nums[i] !== nums[j]) {
            j ++
            nums[j] = nums[i]
        }
    }
    return j +1
}

const nums = [1, 2, 3, 3, 4, 5, 5, 6, 7]
console.log(removeDuplicate(nums));
